/*
 * test_virtual.cc
 *
 *  Created on: Apr 7, 2013
 *      Author: hxin
 */
#include <iostream>

using namespace std;

class people {
public:
	people(int age) {
		this->age = age;
	};
	int getAge() {
		return age;
	};
	virtual int estimateDeath() {
		return age+40;
	};
protected:
	int age;
};

class student : public people {
public:
	student (int age): people(age) {};
	virtual int estimateDeath() {
		return age+20;
	};
};

class gradstud {
public:
	gradstud (int age) {
		this->age = age;
	};
	int estimateDeath() {
		return age + 20;
	};
private:
	int age;
};

int main () {
	people Hongyi(24);
	student Yixin(23);
	gradstud Yoongu(30);
	cout << "Hongyi die: " << Hongyi.estimateDeath() << endl;
	cout << "Yixin die: " << Yixin.estimateDeath() << endl;
	cout << "Yoongu die: " << Yoongu.estimateDeath() << endl;
	cout << "The size of Hongyi: " << sizeof(Hongyi) << endl;
	cout << "The size of Yixin: " << sizeof(Yixin) << endl;
	cout << "The size of Yoongu: " << sizeof(Yoongu) << endl;
	return 0;
}
